<template>
	<view class="flex justify-center" :style="{height:winHeight+'px'}">
		<img src="@/static/images/timg.gif" alt="" style="margin-top:50%;width:400rpx;height:400rpx;" srcset="">
	</view>
</template>

<script>
	export default {
		data() {
			return {
				winHeight: uni.getSystemInfoSync().windowHeight,
				formattedDate: '',
			};
		},
		methods: {
			wxlogon() {
				uni.showLoading({
					title: '加载中',
				});
				uni.login({
					provider: 'weixin',
					success: (res) => {
						console.log('res-login', res);
						this.$https('/weixin_get_openid_session_key_api', {
							app_id: getApp().globalData.appID,
							app_secret: "dcbd19d1b9f65ca7f72839ca1f727428",
							wx_code: res.code
						}).then(res => {
							console.log('res-loginresresresres', res);
							let user_id = res.user_message.user_id
							getApp().globalData.userIfon = res.user_message
							if (res.is_register) {
								wx.reLaunch({
									url: "/pages/home/index"
								});
							} else {
								uni.navigateTo({
									url: "/pages/login/index"
								})
							}
						})
					},
					complete: () => {
						// 隐藏loading
						uni.hideLoading();
					},
				});
			}
		},
		onShow() {
			wx.reLaunch({
				url: "/pages/home/index"
			});
			this.wxlogon()
		}
	};
</script>

<style>
</style>